<template>
	<view class="container">
		<view class="total">已累计创作 {{ total }} 款</view>
		<!-- 红包封面列表 -->
		<view class="package">
			<view class="cover">
				<view class="item" @click="onDraw(item.task_id)" v-for="(item,index) in draw" :key="index">
					<view class="image">
						<u--image :src="item.draw_image_url" width="100%" radius="5" height="460rpx" mode="aspectFill">
						</u--image>
					</view>
					<view class="title">{{ item.draw_text }}</view>
					<view class="bottom">
						<view class="date">{{ item.create_time }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		draw
	} from '@/api/user.js';
	export default {
		data() {
			return {
				total: 0,
				draw: []
			};
		},
		onLoad() {
			this.getReceive()
		},
		methods: {
			onCopy(url) {
				uni.setClipboardData({
					data: url,
					success: () => {

					}
				})
			},
			onDraw(task_id) {
				uni.navigateTo({
					url: '/pages/draw/detail/index?task_id=' + task_id
				})
			},
			getReceive() {
				draw({}).then(res => {
					this.draw = res.data.draw.data
					this.total = res.data.draw.total
				}).catch(err => {

				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
		font-size: 28rpx;
	}

	.total {
		text-align: center;
		background-color: #f6f7f9;
		padding: 30rpx 0rpx;
		color: #82848a;
	}

	.package {
		width: 92%;
		margin: 15rpx auto;

		.cover {
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;
			justify-content: space-between;

			.item {
				width: 330rpx;
				box-shadow: 5rpx 5rpx 10rpx #eee;
				margin-bottom: 10rpx;
				border-radius: 15rpx;
				overflow: hidden;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;

				.image {
					width: 100%;
				}

				.title {
					width: 90%;
					margin: 15rpx 0rpx;
				}

				.bottom {
					width: 90%;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					margin: 15rpx;
					margin-left: 0rpx;

					.left {
						display: flex;
						flex-direction: row;
						align-items: center;
					}
				}
			}
		}
	}
</style>
